Repository navigation
fix: detect relocated uv and pipx tool installations - #5103
Open
Shubham-Padkonde wants to merge 4 commits into
Open
Shubham-Padkonde wants to merge 4 commits into
Shubham-Padkonde wants to merge 4 commits into
Conversation
Assisted-by: Codex (model: GPT-6, autonomous)
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A verified gap in tilde-prefixed PIPX_HOME handling still prevents valid relocated installations from being upgraded.
1 open issue
What changed in this PR
Extends Specify CLI’s install detection so specify self upgrade can recognize relocated uv and pipx installations, targeting the problem reported in #5095.
Changes:
- Adds relocation variables and current platform defaults while retaining legacy paths.
- Adds regression cases for supported layouts, sibling-directory rejection, and unset or empty variables.
- Documents the environment settings needed when upgrading relocated installations.
| File | Description |
|---|---|
tests/specify_cli/test_version_detection.py |
Adds positive and negative relocation-detection cases. |
src/specify_cli/_version.py |
Expands installer prefixes and ignores unconfigured directory variables. |
docs/upgrade.md |
Explains relocation support and required environment settings. |
Review effort: Max
Collaborator
|
Please address Copilot feedback |
Assisted-by: Codex (model: GPT-6, autonomous)
Collaborator
|
Please address Copilot feedback |
Preserve path boundaries and unset-variable guards while resolving PIPX_HOME against the installer working directory. Add current Windows and legacy macOS uv layouts with positive and sibling-path regressions. Assisted-by: OpenAI Codex (model: GPT-6, autonomous)
Resolve UV_TOOL_DIR against the working directory while preserving sibling boundaries and rejecting relative XDG_DATA_HOME prefixes. Assisted-by: OpenAI Codex (model: GPT-6, autonomous)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Fixes #5095.
specify self upgradeclassifies valid uv/pipx installations outside the old hard-coded folders as unsupported. Detect relocated tool environments throughUV_TOOL_DIR,PIPX_HOME, XDG data locations, and platform defaults while retaining legacy paths.The review fixes also recognize uv's current
%APPDATA%/uv/toolsand legacy macOS~/Library/Application Support/uv/toolsdirectories. Expand a literal tilde after substituting environment variables, and resolve relativePIPX_HOMEandUV_TOOL_DIRvalues against the working directory, as their installers do. Unset/empty/unresolved-variable guards, path-component boundaries, and registry fallback restrictions remain intact. Relative XDG paths are still rejected.The upgrade guide explains that relocation variables must remain set when running the installer. Ephemeral uvx detection and copied Windows entrypoint shims outside the tool environment are outside this path-detection change.
Validation
Windows, Python 3.14.6, using this checkout's own virtualenv:
python -m pytest tests/specify_cli/test_version_detection.py tests/specify_cli/test_version_execution.py tests/specify_cli/test_version_guidance.py tests/specify_cli/test_version_verification.py tests/specify_cli/test_version_release.py tests/specify_cli/selfs/test_command_upgrade.py -q: 175 passed, 4 skipped.Four new review regressions fail at the preceding PR commit: the two uv layouts and
PIPX_HOME=./pipx-home/../pipx-home. All pass after the fix. Sibling-directory negative controls pass before and after. The original change had twelve failing layout regressions on base.Installed the patched package using pipx into an isolated relative
PIPX_HOME; its real environment entrypoint detectspipxduringself upgrade --dry-run --tag v1.2.3. No upgrade was executed. pipx's copied external Windows shim remains unrecognized, as noted above.The latest two
UV_TOOL_DIR=./tools/../toolsregressions fail on the preceding PR commit and pass after this fix. Sibling-directory controls and relative XDG rejection pass. An isolated non-editableuv tool installwith a relativeUV_TOOL_DIRdetectsuv toolthrough the real installed executable duringself upgrade --dry-run; no upgrade was executed.CLI help and
git diff --checkpass. Ruff reports the same seven existing findings on base and head, with no added findings.macOS/Linux folder layouts are fixtures on Windows, not native installations. The full repository suite was not run.
AI Disclosure
I did not use AI assistance for this contribution
I did use AI assistance
OpenAI Codex (GPT-6), operating autonomously on behalf of Shubham-Padkonde, investigated the issue and review feedback, wrote code/tests/documentation, ran validation, and drafted this description. The exact model variant/reasoning setting is not exposed to the agent. No personal line-by-line human review is claimed. Agent-authored commits identify assistance in their trailers.